package collect.collection.set;

import java.util.Iterator;
import java.util.TreeSet;

public class TestTreeSet {
    public static void main(String[] args) {
        TreeSet<Integer> set = new TreeSet<>();
        set.add(10);
        set.add(12);
        set.add(11);
        set.add(15);
        set.add(11);

        System.out.println(set);
        System.out.println("=================");
        for (Integer integer : set) {
            System.out.println(integer);
        }
        System.out.println("=================");
        Iterator it = set.iterator();
        while (it.hasNext()) {
            Object o = it.next();
            System.out.println(o);
        }
        System.out.println("=================");
        set.forEach(Integer -> System.out.println(Integer));
        System.out.println("=================================");

    }
}
